<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <h2>Object.defineProperty使用</h2>
</body>
<script>
    let obj={}
   
    Object.defineProperty(obj,'mingzi',{
        value:'小明',
        // //可修改
         writable:true,
        // //可枚举
        enumerable:true,
        //获取
        get:function() {

        },
        //设置
        set:function() {
            
        }
    })

   obj.mingzi='小王'
   obj.age=20
   for(let key in obj) {
    console.log(obj[key])
   }
</script>
</html>